﻿#include "esp32.h"
esp32::esp32(QObject *parent)
{
    m_stop = false;
}
void esp32::stop()
{
    m_stop = true;
}
void esp32::run()
{
    udp=new QUdpSocket;
    udp->bind(QHostAddress::Any, 8001);
   // udp->bind(QHostAddress("192.168.137.125"),9000);
    connect(udp,&QUdpSocket::readyRead,this,[=](){
        qDebug()<<"!!!";
        QByteArray arr;
           arr.resize(udp->bytesAvailable());
           udp->readDatagram(arr.data(),arr.size());
           qDebug()<<arr;

    });
  qDebug() << "esp32 is running!";
  while(!m_stop)
  {
  }
  qDebug() << "uiManager is end";
  emit isDone();
}
void esp32::setUdpHost(QHostAddress host)
{
    esp32host=host;
}
